#include <iostream>
#include <sstream>
#include <vector>

bool check(std::string s, int p)
{
    int res = 0;
    for (int i = p - 1; i >= 0 && s[i] == '\\'; i--)
    {
        res++;
    }

    return res % 2 == 0;
}

int main()
{
    std::stringstream buf;
    buf << std::cin.rdbuf();

    std::string s = buf.str();
    int n = s.length();
    std::vector<int> tag(n);

    int last = -1;
    for (int i = 0; i < n; i++)
    {
        if (last == -1)
        {
            if (s[i] == '\'' || s[i] == '"')
            {
                if (check(s, i))
                {
                    last = i;
                }
            }
        }
        else
        {
            if (s[i] == s[last] && check(s, i))
            {
                for (int p = last; p <= i; p++)
                {
                    tag[p] = 1;
                }
                last = -1;
            }
        }
    }

    for (int i = 0; i < n - 1; i++)
    {
        if (tag[i])
            continue;
        if (s[i] == '-' && s[i + 1] == '-' && check(s, i))
        {
            int p = i;
            while (p + 1 < n && s[p] != '\n')
                p++;
            for (int j = i; j <= p; j++)
                tag[j] = 2;
        }
    }

    std::vector<int> delim;
    delim.push_back(-1);
    for (int i = 0; i < n; i++)
    {
        if (tag[i])
            continue;
        if (s[i] == ';')
            delim.push_back(i);
    }
    delim.push_back(n);

    int ans = 0;
    for (int i = 1; i < delim.size(); i++)
    {
        int l = delim[i - 1] + 1, r = delim[i] - 1;
        int cod = 0;
        for (int j = l; j <= r; j++)
        {
            if (s[j] != ' ' && s[j] != '\t' && tag[j] != 2 && s[j] != '\n')
                cod = 1;
        }
        ans += cod;
    }
    std::cout << ans << std::endl;

    return 0;
}